Netfront must switch state using xenbus_switch_state() or this
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Mon, 10 Apr 2006 17:56:34 +0000 (18:56 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Mon, 10 Apr 2006 17:56:34 +0000 (18:56 +0100)
is not picked up by the waiting code in xenbus_probe.c.

Also clean up the waiting code a little.

Signed-off-by: Keir Fraser <keir@xensource.com>
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c

index 1336be5432c86a248b1db38004af432ee5840fe9..9a1aebefd78bf60896d58ce86dea234284185019 100644 (file)
@@ -300,13 +300,6 @@ again:
                goto abort_transaction;
        }
 
-       err = xenbus_printf(xbt, dev->nodename,
-                           "state", "%d", XenbusStateConnected);
-       if (err) {
-               message = "writing frontend XenbusStateConnected";
-               goto abort_transaction;
-       }
-
        err = xenbus_transaction_end(xbt, 0);
        if (err) {
                if (err == -EAGAIN)
@@ -315,6 +308,8 @@ again:
                goto destroy_ring;
        }
 
+       xenbus_switch_state(dev, XenbusStateConnected);
+
        return 0;
 
  abort_transaction:
index 945a129cf1c6d7156416b66b339cde12f1fdc7e4..94fd44f7f9d5e9c82a2e0ffca068c6ed2f6d49cf 100644 (file)
@@ -1065,19 +1065,16 @@ postcore_initcall(xenbus_probe_init);
  */
 static int __init wait_for_devices(void)
 {
-       int i;
-
-       for (i = 0; i < 10 * HZ; i++) {
-               if (all_devices_ready()) {
-                       return;
-               }
+       unsigned long timeout = jiffies + 10*HZ;
 
-               set_current_state(TASK_INTERRUPTIBLE);
-               schedule_timeout(1);
+       while (time_before(jiffies, timeout)) {
+               if (all_devices_ready())
+                       return 0;
+               schedule_timeout_interruptible(HZ/10);
        }
 
-       printk(KERN_WARNING
-              "XENBUS: Timeout connecting to devices!\n");
+       printk(KERN_WARNING "XENBUS: Timeout connecting to devices!\n");
+       return 0;
 }
 
 late_initcall(wait_for_devices);